package com.ylbh.modules.member.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.pojo.member.dto.AddressDTO;
import com.ylbh.common.pojo.member.vo.ShoppingAddressVO;
import com.ylbh.common.utils.PageUtils;
import com.ylbh.modules.member.entity.ShoppingAddress;
import com.ylbh.modules.member.mapper.AddressMapper;
import com.ylbh.modules.member.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, ShoppingAddress >implements AddressService{

    @Autowired
    private AddressMapper AddressMapper;
    @Override
    public PageUtils queryAddressList(AddressDTO addressDTO) {

        Page<Object> page =  new Page<>(addressDTO.getPage(),addressDTO.getLimit());
        List<ShoppingAddressVO> list = AddressMapper.selectAddressList(addressDTO,page);
        Page<ShoppingAddressVO> page1 = new Page<>();
        page1.setRecords(list).setTotal(page.getTotal());
        return new PageUtils(page1);
    }
}
